Overview

Row

Worldwide Confirmed

21,672,186

Death

775,244 ( 3.6 %)

Recovered

13,676,868 (63.1%)

Row

Top affected countries

Datasets

Countries over date

Row

Top recovered countries

Top countries with death

World Map

Column

Countries with more than 50k confirmed cases

Situation of Bangladesh

Row

Worldwide Confirmed

276,549

Death

3,657 (1.3%)

Recovered

158,950 (57.5%)

Column

Districts with more than 2500 confirmed cases(This map was last updated on 15 August,2020.)

Overall Scenario of Bangladesh

---
title: "Covid-19 Dashboard by Ashiq"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    social: menu
    vertical_layout: scroll
    theme: cerulean
    source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(leaflet)
load("datafinal.Rdata")
load("df.Rdata")
#source("Data manipulation.R",local = T)
theme_set(ggthemes::theme_economist())

```

Overview
====================================================================

Sidebar{.sidebar}
---------------------------------------------------------------
Last updated:
```{r}
library(lubridate)
d <- Sys.Date()-1
 paste(day(d),months(d),",2020") 
```

_About :_
My name is **Md Asrafur Rahman Ashiq**.I am a student of the department of Statistics at University of Dhaka,Bangladesh.I tried to build this dashboard.It's my first dashboard.Any kinds of mistake should be forgiven and mentioned.

Data source: ```coronavirus``` package from Comprehensive R Archive Network(CRAN).

[Know more about me(LinkedIn)]("https://www.linkedin.com/in/md-asrafur-rahman-ashiq-5462ab1a0/")

 Row
----------------------------------------------

### Worldwide Confirmed {.value-box}
```{r}
valueBox(value = paste(format(sum(df$cases_new,na.rm = T), big.mark = ","), "", sep = " "), 
         caption = "Total Confirmed Cases", 
         icon = "fas fa-user-md", 
         color ="violet")
```

### Death {.value-box}
```{r}
valueBox(value = paste(format(sum(df$deaths_new, na.rm = TRUE), big.mark = ","), " (",
                       round(100 * sum(df$deaths_new, na.rm = TRUE) / sum(df$cases_new,na.rm = T), 1), 
                       "%)", sep = " "),
         caption = "Death Cases", 
         icon = "fa-heartbeat", 
         color = "#FF3333")
```

### Recovered {.value-box}
```{r}
valueBox(value = paste(format(sum(df$recovered_new, na.rm = TRUE), big.mark = ","), " (",
                       round(100 * sum(df$recovered_new, na.rm = TRUE) / sum(df$cases_new,na.rm = T), 1), 
                       "%)", sep = ""),
         caption = "Recovered Cases", 
         icon = "fa-walking", 
         color = "#33FFCC")
```

 Row {.tabset}
------------------------------------------------------------------

### Top affected countries

```{r}
library(highcharter)
df%>%filter(location %in% df$location[1:12])%>%       
  hchart("column",hcaes(x=location,y=cases_new,color=location),name="Confirmed Cases",dataLabels = list(align = "center", enabled = TRUE)) %>%hc_yAxis(title=list(text="Total confirmed case")) %>%hc_xAxis(title="")%>%hc_add_theme(hc_theme_ggplot2())
```

### Datasets

```{r}
d <- df%>%select(-lat,-long)  %>% rename(Cases=cases_new,
                                         Deaths=deaths_new,
                                         Recovered=recovered_new)
d$lat <- NULL
d %>%DT::datatable()
```

### Countries over date
```{r}
data %>% filter(location==df$location[1:10]) %>% group_by(location,date) %>%
  summarise(sum=sum(value))%>% mutate(cum=cumsum(sum)) %>% hchart("line",hcaes(x=date,y=cum,group=location))%>%hc_yAxis(title=list(text="Cumulative Confirmed cases"))
```

 Row {.tabset}
------------------------------------------------------------

### Top recovered countries
```{r}
r <-  df %>%arrange(-recovered_new)
r %>% filter(location %in% r$location[1:12])%>%       
  hchart("column",hcaes(x=location,y=recovered_new,color=location),name="Recovered",dataLabels = list(align = "center", enabled = TRUE)) %>% hc_yAxis(title=list(text="Total Recovered case")) %>%hc_xAxis(title="") %>%hc_add_theme(hc_theme_ggplot2())
```


### Top countries with death

```{r}
df%>%filter(location %in% df$location[1:12])%>%       
  hchart("column",hcaes(x=location,y=cases_new,color=location),name="Confirmed Cases") %>%hc_yAxis(title=list(text="Total death cases")) %>%hc_xAxis(title="")
```


World Map
================================================================
Sidebar{.sidebar}
---------------------------------------------------------------
Wikipedia says,In December 2019, a pneumonia outbreak was reported in Wuhan, China.On 31 December 2019, the outbreak was traced to a novel strain of coronavirus, which was given the interim name 2019-nCoV by the World Health Organization (WHO), later renamed SARS-CoV-2 by the International Committee on Taxonomy of Viruses.

As of **15 August 2020**, there have been at least 765,029 confirmed deaths and more than 21,173,009 confirmed cases in the COVID-19 pandemic. The Wuhan strain has been identified as a new strain of Betacoronavirus from group 2B with approximately 70% genetic similarity to the SARS-CoV.[114] The virus has a 96% similarity to a bat coronavirus, so it is widely suspected to originate from bats as well. The pandemic has resulted in travel restrictions and nationwide lockdowns in many countries. 

Column {data-width=650}
-----------------------------------------------------------------------

### Countries with more than 50k confirmed cases
```{r fig.height=6.4}
df %>% 
 filter(cases_new>50000) %>% leaflet()%>%addTiles()%>%
   addProviderTiles("Esri.WorldImagery")%>%setView(0,0,zoom = 2.3)%>%
  addMarkers(lat = ~lat,lng = ~long,popup   = ~paste(sep="     ",location,"Confirmed Cases :",cases_new,",",
                                                     " Deaths :",deaths_new,",","Recovered :",recovered_new),
             label = ~paste0(location," (Click for details)"),
             labelOptions = labelOptions(textsize = "18px"),
             popupOptions = popupOptions(maxWidth = 200)) 

```

 Situation of Bangladesh
===============================================================

 Row
----------------------------------------------

### Worldwide Confirmed {.value-box}
```{r}
df <- df %>% filter(location=="Bangladesh")
valueBox(value = paste(format(sum(df$cases_new,na.rm = T), big.mark = ","), "", sep = " "), 
         caption = "Total Confirmed Cases", 
         icon = "fas fa-user-md", 
         color ="violet")
```

### Death {.value-box}
```{r}
valueBox(value = paste(format(sum(df$deaths_new, na.rm = TRUE), big.mark = ","), " (",
                       round(100 * sum(df$deaths_new, na.rm = TRUE) / sum(df$cases_new,na.rm=T), 1), 
                       "%)", sep = ""),
         caption = "Death Cases", 
         icon = "fa-heartbeat", 
         color = "#FF3333")
```

### Recovered {.value-box}
```{r}
valueBox(value = paste(format(sum(df$recovered_new, na.rm = TRUE), big.mark = ","), " (",
                       round(100 * sum(df$recovered_new, na.rm = TRUE) / sum(df$cases_new,na.rm=T), 1), 
                       "%)", sep = ""),
         caption = "Recovered Cases", 
         icon = "fa-walking", 
         color = "#33FFCC")
```


 Column
---------------------------------------------------------------

### Districts with more than 2500 confirmed cases(This map was last updated on 15 August,2020.)

```{r fig.height=5}
library(sf)
bd <- read_sf("Bangladesh data/BGD_adm2.shp")
district <- readxl::read_xlsx("Bangladesh data/COVID-19.xlsx")
#district <- district %>% mutate_geocode(District,source='dsk')
#save(district,file="lat lon district.Rdata")
load("lat lon district.Rdata")
district <- district  %>% mutate(lab=ifelse(Cases>2500,paste(District,Cases),NA))
m <-  ggplot(bd)+geom_sf(aes(fill=NAME_2))+
  geom_point(data=district,aes(x=lon,y=lat,size=Cases),col="red")+
  ggrepel::geom_label_repel(data=district,aes(x=lon,y=lat,label=as.character(lab),alpha=.5))+theme_minimal()+theme(legend.position = "")
m

```

### Overall Scenario of Bangladesh 

```{r}
data$data_type <- str_replace(data$data_type,"_new","")
data %>% filter(location=="Bangladesh") %>%
  group_by(data_type,date) %>%
  summarise(sum_case=sum(value))%>%
  mutate(cum_case=cumsum(sum_case)) %>% hchart("line",hcaes(x=date,y=cum_case,group=data_type,),dataLabels = list(align = "center", enabled = TRUE)) %>% hc_yAxis(title=list(text="Cumulative Total"))%>% hc_colors(c("#0073C2FF", "#EFC000FF","red")) %>% hc_add_theme(hc_theme_ggplot2())


```